const fs = require('fs');
const path = require('path');
// const dir = path.dirname(__dirname);
const dir = "/Volumes/jacky/web-sd/nodeStudy/day05";
console.log(dir);
let a = 0;
let reFlieName = '';
fs.watch(dir, (event, fileName) => {
    if (event === 'rename' && a === 0) {
        a++;
        reFlieName = fileName;
        console.log(`变更前的文件名${reFlieName}`);
    } else if (a !== 0) {
        a = 0;
        console.log(`变更后的文件名${fileName}`);
    }
    // console.log(a, event);
    // console.log(`${fileName}`);
});;